from app import db
from .base_model import BaseModel


class Category(BaseModel):
    '''分类'''
    __tablename__ = 'category'
    __table_args__ = ({'comment': '文章分类表'})
    id = db.Column(db.Integer, primary_key=True, comment="分类ID")
    name = db.Column(db.String(255), nullable=False, comment="分类名称")
    icon = db.Column(db.String(255), nullable=True, comment="分类图标")

    def __repr__(self) -> str:
        return "<Category %s>" % self.to_json()
